<html>
<head>
	<title>Tests for JanUtils-proto</title>
	
	<script type="text/javascript" src="jsunit/app/jsUnitCore.js"></script>
	<script type="text/javascript" src="../src/janutils.js"></script>
	<script type="text/javascript" src="../src/functions.js"></script>
	<script type="text/javascript" src="../src/string.js"></script>
	<script type="text/javascript" src="../src/janutils-proto.js"></script>
	
	<script type="text/javascript">
	
	//--------------------------------------------------------------------------
	// Tests with correct parameters
	//--------------------------------------------------------------------------
	
	/**
	 * Tests the asMethod() function
	 */
	function testAsMethod() {
		var hello = function (str) {
			return 'Hello: ' + str + '!!!';
		};
		
		String.prototype.hello = hello.asMethod();
		
		assertEquals('Hello: JanUtils!!!', 'JanUtils'.hello());
	}
	
	/**
	 * Tests isEmpty() with an expected input
	 */
	function testIsEmpty() {
		assertTrue(''.isEmpty());
	}
	
	/*
	 * Tests isBlank() with an expected input
	 */
	function testIsBlank() {
		assertTrue('      '.isBlank());
	}
	
	/*
	 * Tests isDigits() with an expected input
	 */
	function testIsDigits() {
		assertTrue('0123456789'.isDigits());
	}
	
	/*
	 * Tests isInteger() with a negative integer
	 */
	function testIsInteger() {
		assertTrue('-123456789'.isInteger());
	}
	
	/*
	 * Tests isDecimal() with a negative number
	 */
	function testIsDecimalNegative() {
		assertTrue('-1234.56789'.isDecimal());
	}

	/*
	 * Tests isDate() with a valid date in dd/MM/yyyy format
	 */
	function testIsDate() {
		assertTrue('20/03/1982'.isDate('dd/MM/yyyy'));
	}

	/*
	 * Tests isEmail() with a valid email
	 */
	function testIsEmail() {
		assertTrue('janutils@gmail.com'.isEmail());
	}
	
	/*
	 * Tests trim() with a string with spaces in both sides
	 */
	function testTrim() {
		assertEquals('JanUtils', '    JanUtils   '.trim());
	}
	
	</script>
</head>
<body>
</body>
</html>
